// 封装axios   见axios-cn
import axios from "axios"
// 定义默认实例
const instance = axios.create({
    // 基础url
    baseURL:'https://www.linweiqin.cn/api/public/v1/'
})
// 拦截器
// Add a request interceptor
instance.interceptors.request.use(function (config) {
    // Do something before request is sent
    return config;
  }, function (error) {
    // Do something with request error
    return Promise.reject(error);
  });

// Add a response interceptor
instance.interceptors.response.use(function (response) {
    // Any status code that lie within the range of 2xx cause this function to trigger
    // Do something with response data
    // 在这里过滤响应信息
    return response.data.message;
  }, function (error) {
    // Any status codes that falls outside the range of 2xx cause this function to trigger
    // Do something with response error
    return Promise.reject(error);
  });

export default instance